#include "../include/debug.hpp"


dbg::Debug::Debug(bool isDebugOn) : _isDebugOn(isDebugOn) { }

void dbg::Debug::print(dbg::DebugPrintType printType, std::string text) {
	time_t seconds = time(NULL);
	tm* timeinfo = localtime(&seconds);

	if (_isDebugOn) {
		std::cout << "[";

		switch (printType) {
		case DEBUG_INFORMATION:
			std::cout << termcolor::green << "INFO";
			break;
		case DEBUG_WARNING:
			std::cout << termcolor::yellow << "WARN";
			break;
		case DEBUG_ERROR:
			std::cout << termcolor::red << "ERR";
			break;
		}

		std::cout << termcolor::reset << "] " << text << " | " << std::asctime(timeinfo);
	} else if (printType == DEBUG_ERROR) {
		std::cout << "[" << termcolor::red << "ERR" << termcolor::reset << "] " << text << " | " << std::asctime(timeinfo);
	}
}
